//
//  FGCustomAlertVC.h
//  YouYin
//
//  Created by LWF on 16/10/28.
//  Copyright © 2016年 YouYin. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "FGAlertConfigure.h"

#define kTitleLabelTag 678
#define kTopViewTag  798
#define kBottomViewTag 767

typedef void (^CallBackBlock)(NSInteger buttonIndex);

API_DEPRECATED("No longer supported; please use FGBaseAlertView instead", ios(4.0, 8.0)) @interface FGCustomAlertVC : UIViewController

/**  主要用于调整内容的frame 默认居中显示 不访问不会创建 */
@property (nonatomic, strong, readonly) UIView *contentView;
/**    设置透明度渐变  默认YES   */
@property (nonatomic, assign) BOOL showWithAlphaAnimate;
/**   点击遮盖能否dismiss  默认YES   */
@property (nonatomic, assign) BOOL canTouchDismiss;
@property (nonatomic, weak) UITextField *tf;
/**    上部分父控件     */
@property (nonatomic, weak) UIView *topView;
/**    中间的父控件（新版本弹框才有）     */
@property (nonatomic, weak) UIView *middleView;
/**    下部分父控件     */
@property (nonatomic, weak) UIView *bottomView;
/**      只有candelete 时才有值     */
@property (nonatomic, weak) UIButton *deleteBtn;


- (void)show;
- (void)showWithDuration:(NSTimeInterval)duration;

- (void)dismiss;
- (void)dismissCompletion:(void (^)(void))completion;

/**    自定义事件响应： 将所有事件响应转到一个block中 tag:区分事件 dismiss:是否需要dismiss execute: 是否需要执行block回调     */
+ (void)actionWithTag:(NSInteger)tag dismiss:(BOOL)dismiss executeBlock:(BOOL)execute;

/**    最原始方法     */
+ (instancetype)alertWithCustomView:(UIView *)customView;

#pragma mark - 从底部钻出来的
/**
 alertVC.touchBgBlock = ^(BOOL canTouchDismiss){
 if (canTouchDismiss) {
 
 }
 };
 */
@property (nonatomic, copy) void(^touchBgBlock)(BOOL canTouchDismiss);
@property (nonatomic, copy) void(^didSelectRowBlock)(NSIndexPath *indexPath, NSString *selectedTitle);
/**  dataList格式  @[@[@"拍照",@"从相册选取"],@[@"取消"]]     */
@property (nonatomic, strong) NSArray *dataList;
+ (instancetype)fromBottomAlert;

#pragma mark - 不需要show
/**    不需要show  点击后才消失   */
+ (instancetype)alertWithMessage:(NSString *)message;
/**    不需要show   自动消失  */
+ (instancetype)alertWithMessage:(NSString *)message duration:(NSTimeInterval)duration;

#pragma mark  模仿UIAlertView
/**    最多显示2个按钮  btnColors = nil使用默认颜色   点击删除按钮 CallBackBlock返回-1   block内self不会有内存问题  */
+ (instancetype)alertWithTitle:(NSString *)title icon:(NSString *)icon canDelete:(BOOL)canDelete buttonTitles:(NSArray<NSString *> *)btnTitles buttonColors:(NSArray<UIColor *> *)btnColors showUsingBlock:(CallBackBlock)block;

#pragma mark - 新版弹框

/**
 * top、middle、bottomView 自己创建
 * 默认高度topView 135   middleView 145 bottomView 50  点击删除按钮 CallBackBlock返回-1
 *     *topH = 0时使用默认高度， 若要隐藏一个 *topH <= 0.1
 */
+ (instancetype)alertWithTopView:(UIView *)topView middleView:(UIView *)middleView bottomView:(UIView *)bottomView canDelete:(BOOL)canDelete heightsBlock:(void(^)(CGFloat *topH,CGFloat *middleH,CGFloat *bottomH))heightsBlock showUsingBlock:(CallBackBlock)block;

/**
 * 最新版本 top、middle、bottom View 传入就用传入的，不传用默认的空白页
 * 事件响应: + (void)actionWithTag:(NSInteger)tag dismiss:(BOOL)dismiss executeBlock:(BOOL)execute
 */
+ (instancetype)alertWithTopView:(UIView *)topView middleView:(UIView *)middleView bottomView:(UIView *)bottomView heightsBlock:(void(^)(CGFloat *topH,CGFloat *middleH,CGFloat *bottomH))heightsBlock showUsingBlock:(CallBackBlock)block;

/**
 * top、middle、bottomView 创建已创建好了
 * 默认高度topView 135   middleView 145 bottomView 50  点击删除按钮 CallBackBlock返回-1
 *     *topH = 0时使用默认高度， 若要隐藏一个 *topH <= 0.1
 */
+ (instancetype)alertWithBlock:(void(^)(FGAlertConfigure *make))configureBlock heightsBlock:(void(^)(CGFloat *topH,CGFloat *middleH,CGFloat *bottomH))heightsBlock showUsingBlock:(CallBackBlock)block;

@end
